package com.datasource.dialect;

public class MSSQLDialect implements Dialect
{
	public boolean supportsCommitAndRollback() 
	{
		return true;
	}

	public boolean supportsSavePoints() 
	{
		return false;
	}
	
	public boolean supportPageLimit() 
	{
		return false;
	}
	
	public boolean isProc() 
	{
		return false;
	}
	
	public String getPageString(String sql, int startIndex, int pageSize) 
	{
		//exec Pr_QueryByPage 'select * from Area order by areaid',1,10
		startIndex = startIndex/pageSize +1;
		sql = sql.replace("\'", "\'\'");
		sql = "exec Pr_QueryByPage \'"+sql+"\',"+startIndex+","+pageSize+"";
		return sql;
	}
    
    public String getLockTableString( String tableName )
    {
        return new StringBuffer("LOCK TABLE ").append( tableName).append(" IN EXCLUSIVE MODE").toString();
    }

    public String getUnLockTableString()
    {
        return null;
    }
    
  
}
